<!doctype html>
<html lang="en" style="height: 100%">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
          name="viewport">
    <meta content="ie=edge" http-equiv="X-UA-Compatible">
    <title>项目配置界面</title>
    <link href="../metronic/assets/global/plugins/jstree/css/style.min.css" rel="stylesheet" type="text/css"/>
    <link href="../metronic/assets/global/plugins/jquery.toast.css " rel="stylesheet"/>
    <!-- BEGIN GLOBAL MANDATORY STYLES -->
    <link href="../metronic/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet"
          type="text/css"/>
    <link href="../metronic/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet"
          type="text/css"/>
    <link href="../metronic/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <link href="../metronic/assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
    <link href="../metronic/assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet"
          type="text/css"/>
    <link href="../metronic/assets/global/plugins/bootstrap-touchspin/bootstrap.touchspin.min.css" rel="stylesheet"
          type="text/css"/>
    <!-- END GLOBAL MANDATORY STYLES -->
    <!-- BEGIN PAGE LEVEL STYLES -->
    <link href="../metronic/assets/global/plugins/select2/select2.css" rel="stylesheet" type="text/css"/>
    <link href="../metronic/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css"
          rel="stylesheet"
          type="text/css"/>
    <!-- END PAGE LEVEL STYLES -->
    <!-- BEGIN THEME STYLES -->
    <link href="../metronic/assets/global/css/components.css" id="style_components" rel="stylesheet" type="text/css"/>
    <link href="../metronic/assets/global/plugins/bootstrap/css/bootstrap-table.css" rel="stylesheet" type="text/css"/>
    <link href="../metronic/assets/global/plugins/bootstrap/css/bootstrap-editable.css" rel="stylesheet"
          type="text/css"/>
    <link href="../metronic/assets/global/plugins/bootstrap/css/bootstrap-table-fixed-columns.css" rel="stylesheet"
          type="text/css"/>
    <link
            href="../metronic/assets/global/plugins/bootstrap-select/bootstrap-select.css"
            rel="stylesheet"
    />
    <!-- END THEME STYLES -->
    <style type="text/css">
        .form-horizontal .form-group {
            margin-right: 0px;
            margin-left: 0px;
        }

        .table {
            border-top: solid 3px #F3565D;
        }

        #tab_left .active {
            border-left: solid 3px #F3565D;
        }

        .select2-container .select2-choice {
            height: 30px !important;
            border-radius: 4px !important;
        }

        .b {
            /*height:1px;*/
            /*background-color: rgba(36, 64, 76, 0.13);*/
            /*border-bottom:1px solid rgba(113, 42, 61, 0.73);*/
            /*margin:1em 0;*/
            /*overflow:hidden;*/
            -webkit-box-shadow: #666 0px 0px 10px;
            -moz-box-shadow: #666 0px 0px 10px;
            box-shadow: #666 0px 0px 10px;
            /*background: #EEFF99;*/
            background: #ffffff;
        }

        .tableft {
            margin-left: 90px !important;
        }

        html, body {
            height: 100%;
        }
    </style>
</head>

<body
        class="page-header-fixed page-quick-sidebar-over-content "
        style="height: 100%;width: 98%; background: #0f0; background-color: transparent;"
>
<div class="row" style="height: 100%">
    <div class="col-md-12" style="height: 100%;">
        <!-- BEGIN EXAMPLE TABLE PORTLET-->
        <div class="portlet box blue-steel" style="height: 100%;">
            <div class="portlet-body" style="height: 100%;overflow: auto">
                <div class="app" style="margin-left: -15px;margin-top: -20px;height: 100%;">
                    <div style="height: 99%;width:24%;float: left">
                        <div class="row" style="margin-top: 5px;margin-bottom:5px;width: 90%">
                            <div class="col-md-3" style="width: 200px">
                                <input
                                        class="form-control"
                                        id="seachTxt"
                                        placeholder="请输入关键字"
                                        type="text"
                                />
                            </div>
                            <div class="col-md-3" style="margin-left: -20px">
                                <div class="btn-group">
                                    <button class="btn blue-steel" id="btn_Search">
                                        查询 <i class="fa fa-search"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div id="container" class="b"
                             style="height: 94%;overflow: auto;margin-top: 0.51%;">
                        </div>
                    </div>
                    <div id="showTable" class="portlet box blue-steel"
                         style="height: 98%;width: 75%;overflow: auto; margin-left: 10px; margin-right: 0px;margin-bottom:0px;margin-top: 5px;display: inline-block">
                        <div class="portlet-title">
                            <div class="caption">
                                <i class="fa fa-globe"></i>数据资源目录
                            </div>
                            <div style="margin-left: 150px;margin-top: 5px;">
                                <span class="input-group-addon" id="total_count"
                                      style="width: 200px;text-align: center;"></span>
                            </div>
                        </div>
                        <div class="portlet-body" style="height: 94.9%;overflow: auto;padding-bottom: 0px">
                            <div class="row" style="overflow: auto">
                                <table id="tb_configList"></table>
                            </div>
                        </div>
                    </div>
                    <div id="showDetil" name="oDiv"
                         style="height: 98%;width:75%; margin-left: 10px; margin-right: 0px;display: none">
                        <iframe id="showDetilIframe" name="showDetilIframe"
                                style="width:100%; height:100%; border:solid 0px red;"
                                src=""></iframe>
                    </div>
                </div>
            </div>
        </div>
        <!-- END EXAMPLE TABLE PORTLET-->
    </div>
</div>

<!-- Begin添加修改modal -->
<!-- End添加修改 -->


<!--Begin js-->
<script src="../metronic/assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/jquery.toast.min.js" type="text/javascript"></script>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>-->
<script src="../metronic/assets/global/plugins/jstree/js/jstree.min.js" type="text/javascript"></script>

<script src="../metronic/assets/global/plugins/jquery-migrate.min.js" type="text/javascript"></script>
<!-- IMPORTANT! Load jquery-ui.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<script src="../metronic/assets/global/plugins/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js"
        type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js"
        type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js"
        type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/bootstrap-touchspin/bootstrap.touchspin.min.js"
        type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="../metronic/assets/global/scripts/metronic.js" type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/bootstrap/js/bootstrap-table.js" type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/bootstrap/js/bootstrap-table-zh-CN.js" type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/bootstrap/js/bootstrap-editable.js" type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/bootstrap/js/bootstrap-table-editable.js"
        type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/bootstrap/js/bootstrap-table-fixed-columns.js"
        type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/bootbox/bootbox.min.js" type="text/javascript"></script>
<script src="../metronic/assets/global/plugins/bootstrap-select/bootstrap-select.js"></script>
<script src="../metronic/assets/global/plugins/bootstrap-select/i18n/defaults-zh_CN.js"></script>
<!--<script-->
<!--src="../js/project/projectManager.js"-->
<!--type="text/javascript"-->
<!--&gt;</script>-->
<script type="text/javascript">
    var postPath = "/gdp";
    var jsonobj = {};
    $(function () {
        var mark = GetQueryString("mark");
        getJson(mark);
        $('#container').jstree(jsonobj);
        var initId = '10';
        if (mark === '1') {
            initId = 'B01'
        } else if (mark === '3') {
            initId = 'C01'
        }
        var getList = function (id) {
            //获取该目录下的数据总数
            var recordSum = 0;
            $.ajax({
                type: 'POST',
                url: postPath + '/system/dataConfig/getRecourdTotalById',
                async: false,
                data: {id: id},
                success: function (res) {
                    recordSum = res;
                    $("#total_count").html("数据总量: " + recordSum + " 条");
                    // console.log(res.toString);
                }
            });
            $("#tb_configList").bootstrapTable('destroy');
            $("#tb_configList").bootstrapTable({
                url: postPath + "/system/dataConfig/selectTreeCfgtableList",
                undefinedText: '-',
                pagination: true, // 分页
                striped: true, // 是否显示行间隔色
                queryParams: function (pageReqeust) {
                    var temp = {
                        order: pageReqeust.order,
                        pageNo: pageReqeust.offset / pageReqeust.limit + 1,
                        pageSize: pageReqeust.limit,
                        id: id,
                        paramtxt: "",
                        tableType: 1
                    };
                    return temp;
                },
                cache: false, // 是否使用缓存
                pageSize: 15,
                pageList: [5, 10, 15, 20],
                toolbar: "",// 指定工具栏
                showColumns: false, // 显示隐藏列
                showRefresh: false, // 显示刷新按钮
                uniqueId: "dbKey", // 每一行的唯一标识
                sidePagination: "server", // 服务端处理分页
                columns: [
                    {
                        title: '表名称',
                        field: 'dtName',
                        align: 'left',
                        valign: 'middle',
                        sortable: false
                    },
                    {
                        title: '表中文名称',
                        field: 'dtNameCn', // 字段
                        align: 'center', // 对齐方式（左 中 右）
                        valign: 'middle', //
                        sortable: false
                    }, {
                        title: '主键',
                        field: 'dtPrimarykey',
                        align: 'center',
                        valign: 'middle',
                        sortable: false
                    },
                    {
                        title: '数据量',
                        field: 'dataQuantity',
                        align: 'right',
                        valign: 'middle',
                        sortable: false
                    }, {
                        title: '类别',
                        field: 'moduleMark',
                        align: 'center',
                        valign: 'middle',
                        sortable: false
                    }
                ]

            });
        };
        getList(initId);
        $('#container').on("changed.jstree", function (e, data) {
            var id = String(data.selected);   //必须得转换成字符串
            var haschild = -1;
            var dbkey = '';
            var tableName = '';
            if (id.length <= 30) {
                $("#showTable").css("display", "inline-block");
                $("#showDetil").css("display", "none");
                // getList(dbkey, tableList);
                getList(id);
            } else {
                // console.log("显示详情");
                $.ajax({
                    type: 'POST',
                    url: postPath + '/system/resourceTree/getInfo',
                    async: false,
                    data: {id: id},
                    success: function (res) {
                        dbkey = res.dtConn;
                        tableName = res.dtName;
                    }
                });
                $("#showTable").css("display", "none");
                $("#showDetil").css("display", "inline-block");
                $("#showDetilIframe").attr("src", postPath + "/systemDataConfig/index?ismark=2&dtConfigId=" + dbkey + "_" + tableName);
            }
        });
    });

    function getJson(id) {
        $.ajax({
            type: 'POST',
            url: postPath + '/system/resourceTree/getJStree',
            async: false,
            data: {id: id},
            success: function (res) {
                jsonobj = res;
            }
        });
    }

    function GetQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null;
    }

</script>
</body>
</html>